package com.yexiao.core.response;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author lkl
 * @since 2025/3/7
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResponseData {
    private int code;
    private String msg;
    private Object data;

    // --------------------- 静态工厂方法（简化创建） ---------------------
    public static ResponseData success(Object data) {
        return new ResponseData(200, "success", data);
    }

    public static ResponseData success() {
        return success(null);
    }

    public static ResponseData fail(int code, String msg) {
        return new ResponseData(code, msg, null);
    }

    public static ResponseData fail(String msg) {
        return fail(500, msg);
    }
}
